package com.active.service.listener;

import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.Expression;
import org.activiti.engine.delegate.TaskListener;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;

/**
 * Created by Administrator on 2019/6/14 0014.
 */
@Slf4j
public class CreateTaskListener implements TaskListener,Serializable {

    private Expression content;

    private Expression task;

    @Override
    public void notify(DelegateTask delegateTask) {
        log.info("不知道是什么东西：{}",task.getValue(delegateTask));
        log.info("启动任务监听，任务事件：{}，指定任务执行人：{}",delegateTask.getEventName(),delegateTask.getAssignee());

        delegateTask.setVariable("setInTaskCreate",delegateTask.getEventName()+","+content.getValue(delegateTask));
        delegateTask.setAssignee("zhaogang");
        log.info("修改任务执行人之后：{}",delegateTask.getAssignee());

    }

}
